/*
 * Copyright (c) 2006-2021, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2025-06-10     Administrator       the first version
 */
#ifndef APPLICATIONS_ST7735S_H_
#define APPLICATIONS_ST7735S_H_

#include <bsp.h>

// 引脚定义 (根据实际连接修改)
#define LCD_SCL_PIN        GET_PIN(B, 6)   // 时钟线
#define LCD_SDA_PIN        GET_PIN(B, 7)   // 数据线
#define LCD_DC_PIN         GET_PIN(B, 5)   // 数据/命令选择
#define LCD_RES_PIN        GET_PIN(B, 4)   // 复位引脚
#define LCD_CS_PIN         GET_PIN(B, 3)   // 片选引脚
#define LCD_BLK_PIN        GET_PIN(A, 15)   // 背光控制

// 屏幕参数
#define LCD_WIDTH          80
#define LCD_HEIGHT         160
#define LCD_X_OFFSET       26      // 水平偏移
#define LCD_Y_OFFSET       1       // 垂直偏移
// 颜色定义
#define COLOR_BLACK         0x0000
#define COLOR_WHITE         0xFFFF
#define COLOR_RED           0xF800
#define COLOR_GREEN         0x07E0
#define COLOR_BLUE          0x001F

#define uint8_t   rt_uint8_t
#define uint16_t   rt_uint16_t
#define uint32_t   rt_uint32_t
// 字体数据 (8x16 ASCII)
extern const uint8_t font8x16[];
// 初始化LCD驱动
int lcd_driver_init(void);
// 显示字符串
void lcd_show_string(uint16_t x, uint16_t y, const char *str, uint16_t color, uint16_t bg_color);
// 显示字符 (8x16字体)
void lcd_show_char(uint16_t x, uint16_t y, char ch, uint16_t color, uint16_t bg_color);
// 绘制矩形 (优化版)
void lcd_draw_rect(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t color);
// 绘制像素点
void lcd_draw_point(uint16_t x, uint16_t y, uint16_t color);
// 清屏
void lcd_clear(uint16_t color);
// 设置显示窗口
//static void lcd_set_window(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2);
// 设置显示方向
void lcd_set_orientation(uint8_t orientation);
/*// 初始化LCD
static void lcd_init(void);*/


#endif /* APPLICATIONS_ST7735S_H_ */
